<?php

namespace Home\Model;

use Think\Model\ViewModel;

class LogdataViewModel extends ViewModel
{
    public $viewFields = [
        'Logdata' => [
            'id',
            'workload',
            'ecost',
            'ocost',
            'diff',
            'diff_reason',
            'finish',
            'fileUpload',
            'uid',
            'type',
            'batch',
            'project_code',
        ],
        'Userinfo'=> [
            'company' => 'unit',
            '_on' => 'Userinfo.uid=Logdata.uid',
        ],
    ];

    public function getDataByProjectCode($code)
    {
        return $this->where(['project_code' => $code])->select();
    }
}
